package com.uit.httt04.duongvanlam.facedetection.classes;

public class DistanceAlgorithm extends Object
{
	private int id;
	private String imageName;
	private double distance;

	public static void SortResult(DistanceAlgorithm[] results)
	{
		for (int i = 0; i < results.length - 1; i++)
			for (int j = i + 1; j < results.length; j++)
			{
				if (results[i].getDistance() > results[j].getDistance())
				{
					DistanceAlgorithm temp = results[i];
					results[i] = results[j];
					results[j] = temp;
				}
			}
	}

	public DistanceAlgorithm(double Distance, String ImageName, int ObjectID)
	{
		this.setDistance(Distance);
		this.setImageName(ImageName);
		this.setID(ObjectID);
	}

	public double getDistance()
	{
		return distance;
	}

	private void setDistance(double distance)
	{
		this.distance = distance;
	}

	public String getImageName()
	{
		return this.imageName;
	}

	private void setImageName(String imageName)
	{
		this.imageName = imageName;
	}

	public int getID()
	{
		return id;
	}

	private void setID(int objectID)
	{
		id = objectID;
	}

	@Override
	public void finalize() throws Throwable
	{
		this.imageName = null;
		super.finalize();
	}
}
